import { defineStore } from "pinia";
import { StaffSelectDTO } from "/@/api/staff";
import { store } from "/@/store";

export const useStaffStore = defineStore({
  id: "pure-staff",
  state: (): StaffSelectDTO => ({
    id: null,
    isDisable: false,
    name: "",
    role: "",
    staffNumber: "",
    userName: ""
  }),
  actions: {
    setStaff(value: StaffSelectDTO) {
      this.id = value.id;
      this.isDisable = value.isDisable;
      this.name = value.name;
      this.role = value.role;
      this.staffNumber = value.staffNumber;
      this.userName = value.userName;
    },
    setStaffName(value: string) {
      this.name = value;
    },
    setStaffRole(value: string) {
      this.role = value;
    },
    setStaffUserName(value: string) {
      this.userName = value;
    },
    setStaffNumber(value: string) {
      this.staffNumber = value;
    },
    setStaffIsDisable(value: boolean) {
      this.isDisable = value;
    }
  }
});

export function useStaffStoreHook() {
  return useStaffStore(store);
}
